<?php
class ReportpdfController extends modules_default_controllers_ControllerBase
{
	
	
/**
 * Zend Framework
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://framework.zend.com/license/new-bsd
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@zend.com so we can send you a copy immediately.
 *
 * @category   Zend
 * @package    Zend_Pdf
 * @subpackage Demos
 * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 */

	
    public function indexAction()
    {
	
    	$FONT_SIZE = 12;
    	
        $this->_helper->viewRenderer->setNoRender();
        $this->_helper->layout->disableLayout();

        $pdf = new Zend_Pdf();

//------------------------------------------------------------------------------------
// Reverse page order
$pdf->pages = array_reverse($pdf->pages);

try {
    $stampImage = Zend_Pdf_Image::imageWithPath($_SERVER["DOCUMENT_ROOT"] . '/i/logo.png');
} catch (Zend_Pdf_Exception $e) {
    // Example of operating with image loading exceptions.
    if ($e->getMessage() != 'Image extension is not installed.' &&
        $e->getMessage() != 'JPG support is not configured properly.') {
        throw $e;
    }
    $stampImage = null;
}

// Add new page generated by Zend_Pdf object (page is attached to the specified the document)
$pdf->pages[] = ($page1 = $pdf->newPage(Zend_Pdf_Page::SIZE_LETTER_LANDSCAPE));

// Create new font
$font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);

// Apply font and draw text
$page1 ->drawImage($stampImage,  1, 1,  423, 67)
       ->setFont($font, $FONT_SIZE);

$page1->drawText($page1->getHeight() . ' ' . $page1->getWidth(), 1, $page1->getHeight() - $FONT_SIZE);

// Use font object for another page

//------------------------------------------------------------------------------------


 $docs = $pdf->render();

    header("Content-type: application/pdf"); 
    echo $docs;

//print_r($pdf);

    }
}